<!DOCTYPE html><html lang="zh-CN" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><title>用Swing和MySQL做一个学生管理系统 | Dingzh's Blog</title><meta name="keywords" content="Java,MySQL"><meta name="author" content="Dingzh"><meta name="copyright" content="Dingzh"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="当初自学Java写的一个结课作业，由于Swing太过时了没什么价值，但和之后Web的学习其实有很多相似之处的，蛮摆上来"><meta property="og:type" content="article"><meta property="og:title" content="用Swing和MySQL做一个学生管理系统"><meta property="og:url" content="https://dingzh.cc/posts/1e5fbfe0.html"><meta property="og:site_name" content="Dingzh&#39;s Blog"><meta property="og:description" content="当初自学Java写的一个结课作业，由于Swing太过时了没什么价值，但和之后Web的学习其实有很多相似之处的，蛮摆上来"><meta property="og:locale" content="zh_CN"><meta property="og:image" content="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover57.jpg"><meta property="article:published_time" content="2022-02-17T10:53:02.000Z"><meta property="article:modified_time" content="2025-08-02T12:43:16.794Z"><meta property="article:author" content="Dingzh"><meta property="article:tag" content="Java"><meta property="article:tag" content="MySQL"><meta name="twitter:card" content="summary"><meta name="twitter:image" content="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover57.jpg"><link rel="shortcut icon" href="https://alicdn.dingzh.cc/ding-BlogDemo/img/Favicon.png"><link rel="canonical" href="https://dingzh.cc/posts/1e5fbfe0"><link rel="preconnect" href="//cdn.jsdelivr.net"><link rel="preconnect" href="//busuanzi.ibruce.info"><link rel="manifest" href="/manifest.json"><meta name="msapplication-TileColor" content="#f7cb98"><link rel="apple-touch-icon" sizes="180x180" href="https://alicdn.dingzh.cc/ding-BlogDemo/img/siteicon/apple-touch-icon.png"><link rel="icon" type="image/png" sizes="32x32" href="https://alicdn.dingzh.cc/ding-BlogDemo/img/siteicon/favicon-32x32.png"><link rel="icon" type="image/png" sizes="16x16" href="https://alicdn.dingzh.cc/ding-BlogDemo/img/siteicon/favicon-16x16.png"><link rel="mask-icon" href="https://alicdn.dingzh.cc/ding-BlogDemo/img/siteicon/safari-pinned-tab.svg" color="#5bbad5"><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://npm.elemecdn.com/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://npm.elemecdn.com/node-snackbar/dist/snackbar.min.css" media="print" onload='this.media="all"'><script>const GLOBAL_CONFIG={root:"/",algolia:void 0,localSearch:{path:"search.xml",languages:{hits_empty:"找不到您查询的内容：${query}"}},translate:void 0,noticeOutdate:void 0,highlight:{plugin:"highlighjs",highlightCopy:!0,highlightLang:!0,highlightHeightLimit:250},copy:{success:"复制成功",error:"复制错误",noSupport:"浏览器不支持"},relativeDate:{homepage:!1,post:!1},runtime:"天",date_suffix:{just:"刚刚",min:"分钟前",hour:"小时前",day:"天前",month:"个月前"},copyright:void 0,lightbox:"fancybox",Snackbar:{chs_to_cht:"你已切换为繁体",cht_to_chs:"你已切换为简体",day_to_night:"你已切换为深色模式",night_to_day:"你已切换为浅色模式",bgLight:"#ff6262",bgDark:"#7a3939",position:"top-center"},source:{jQuery:"https://npm.elemecdn.com/jquery@latest/dist/jquery.min.js",justifiedGallery:{js:"https://npm.elemecdn.com/justifiedGallery/dist/js/jquery.justifiedGallery.min.js",css:"https://npm.elemecdn.com/justifiedGallery/dist/css/justifiedGallery.min.css"},fancybox:{js:"https://alicdn.dingzh.cc/ding-BlogDemo/js/other/jquery.fancybox.min.js",css:"https://npm.elemecdn.com/@fancyapps/fancybox@latest/dist/jquery.fancybox.min.css"}},isPhotoFigcaption:!1,islazyload:!0,isanchor:!1}</script><script id="config-diff">var GLOBAL_CONFIG_SITE={title:"用Swing和MySQL做一个学生管理系统",isPost:!0,isHome:!1,isHighlightShrink:!1,isToc:!0,postUpdate:"2025-08-02 20:43:16"}</script><noscript><style>#nav{opacity:1}.justified-gallery img{opacity:1}#post-meta time,#recent-posts time{display:inline!important}</style></noscript><script>(e=>{e.saveToLocal={set:function(e,t,o){if(0===o)return;const n=864e5*o,a={value:t,expiry:(new Date).getTime()+n};localStorage.setItem(e,JSON.stringify(a))},get:function(e){const t=localStorage.getItem(e);if(!t)return;const o=JSON.parse(t);if(!((new Date).getTime()>o.expiry))return o.value;localStorage.removeItem(e)}},e.getScript=e=>new Promise((t,o)=>{const n=document.createElement("script");n.src=e,n.async=!0,n.onerror=o,n.onload=n.onreadystatechange=function(){const e=this.readyState;e&&"loaded"!==e&&"complete"!==e||(n.onload=n.onreadystatechange=null,t())},document.head.appendChild(n)}),e.activateDarkMode=function(){document.documentElement.setAttribute("data-theme","dark"),null!==document.querySelector('meta[name="theme-color"]')&&document.querySelector('meta[name="theme-color"]').setAttribute("content","#0d0d0d")},e.activateLightMode=function(){document.documentElement.setAttribute("data-theme","light"),null!==document.querySelector('meta[name="theme-color"]')&&document.querySelector('meta[name="theme-color"]').setAttribute("content","#ffffff")};const t=saveToLocal.get("theme"),o=(new Date).getHours();void 0===t?o<=6||o>=18?activateDarkMode():activateLightMode():"light"===t?activateLightMode():activateDarkMode();const n=saveToLocal.get("aside-status");void 0!==n&&("hide"===n?document.documentElement.classList.add("hide-aside"):document.documentElement.classList.remove("hide-aside"));const a=saveToLocal.get("global-font-size");void 0!==a&&document.documentElement.style.setProperty("--global-font-size",a+"px");const c=()=>{GLOBAL_CONFIG_SITE.isHome&&/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)&&document.documentElement.classList.add("apple")};c(),document.addEventListener("pjax:complete",c)})(window)</script><script defer src="https://alicdn.dingzh.cc/ding-BlogDemo/js/custom/randombg.min.js"></script><svg aria-hidden="true" style="position:absolute;overflow:hidden;width:0;height:0"><symbol id="icon-sun" viewBox="0 0 1024 1024"><path d="M960 512l-128 128v192h-192l-128 128-128-128H192v-192l-128-128 128-128V192h192l128-128 128 128h192v192z" fill="#FFD878" p-id="8420"></path><path d="M736 512a224 224 0 1 0-448 0 224 224 0 1 0 448 0z" fill="#FFE4A9" p-id="8421"></path><path d="M512 109.248 626.752 224H800v173.248L914.752 512 800 626.752V800h-173.248L512 914.752 397.248 800H224v-173.248L109.248 512 224 397.248V224h173.248L512 109.248M512 64l-128 128H192v192l-128 128 128 128v192h192l128 128 128-128h192v-192l128-128-128-128V192h-192l-128-128z" fill="#4D5152" p-id="8422"></path><path d="M512 320c105.888 0 192 86.112 192 192s-86.112 192-192 192-192-86.112-192-192 86.112-192 192-192m0-32a224 224 0 1 0 0 448 224 224 0 0 0 0-448z" fill="#4D5152" p-id="8423"></path></symbol><symbol id="icon-moon" viewBox="0 0 1024 1024"><path d="M611.370667 167.082667a445.013333 445.013333 0 0 1-38.4 161.834666 477.824 477.824 0 0 1-244.736 244.394667 445.141333 445.141333 0 0 1-161.109334 38.058667 85.077333 85.077333 0 0 0-65.066666 135.722666A462.08 462.08 0 1 0 747.093333 102.058667a85.077333 85.077333 0 0 0-135.722666 65.024z" fill="#FFB531" p-id="11345"></path><path d="M329.728 274.133333l35.157333-35.157333a21.333333 21.333333 0 1 0-30.165333-30.165333l-35.157333 35.157333-35.114667-35.157333a21.333333 21.333333 0 0 0-30.165333 30.165333l35.114666 35.157333-35.114666 35.157334a21.333333 21.333333 0 1 0 30.165333 30.165333l35.114667-35.157333 35.157333 35.157333a21.333333 21.333333 0 1 0 30.165333-30.165333z" fill="#030835" p-id="11346"></path></symbol></svg><link rel="stylesheet" href="https://alicdn.dingzh.cc/ding-BlogDemo/css/card.min.css" media="defer" onload='this.media="all"'><link rel="stylesheet" href="https://alicdn.dingzh.cc/ding-BlogDemo/clock/clock.min.css"><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://alicdn.dingzh.cc/ding-BlogDemo/css/swiperstyle.min.css" media="print" onload='this.media="all"'><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-wowjs/lib/animate.min.css" media="print" onload='this.media="screen"'><link rel="stylesheet" href="https://npm.elemecdn.com/hexo-butterfly-tag-plugins-plus@latest/lib/assets/font-awesome-animation.min.css" media="defer" onload='this.media="all"'><link rel="stylesheet" href="https://alicdn.dingzh.cc/ding-BlogDemo/css/tag_plugins.min.css" media="defer" onload='this.media="all"'><meta name="generator" content="Hexo 6.0.0"></head><body><a href="javascript:void(0);" onclick="preloader.endLoading()" title="点击跳过动画"><div id="loading-box"><div class="pokeball-back"></div><div class="pokeball-loading"><div class="pokeball" id="pokeball-normal"></div><div class="pokeball" id="pokeball-great"></div><div class="pokeball" id="pokeball-ultra"></div><div class="pokeball" id="pokeball-master"></div><div class="pokeball" id="pokeball-safari"></div></div></div></a><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/head1.jpg" onerror='onerror=null,src="https://alicdn.dingzh.cc/ding-BlogDemo/img/imgLink_404.gif"' alt="avatar"></div><div class="site-data"><div class="data-item is-center"><div class="data-item-link"><a href="/archives/"><div class="headline">文章</div><div class="length-num">38</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/tags/"><div class="headline">标签</div><div class="length-num">49</div></a></div></div><div class="data-item is-center"><div class="data-item-link"><a href="/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div></div></div><hr><div class="menus_items"><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-shouye"></use></svg> <span>首页</span></a></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-zixun"></use></svg> <span>文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/archives/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-danganku"></use></svg> <span>归档</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/tags/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-biaoqian"></use></svg> <span>标签</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/categories/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-wenjianjia"></use></svg> <span>分类</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-guochandonghuatuijian"></use></svg> <span>动漫</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/anime/tv/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-anime"></use></svg> <span>季度</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/anime/collect/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-vpszhujifuwuqiwangluo"></use></svg> <span>藏馆</span></a></li><li><a class="site-page child faa-parent animated-hover" target="_blank" rel="noopener" href="https://github.com/rplalala/MySubTittle"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-dianying"></use></svg> <span>字幕</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-switch2"></use></svg> <span>其他</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/gallery/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangce"></use></svg> <span>图库</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/artitalk/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-pinglun1"></use></svg> <span>随言</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/messageboard/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-rili"></use></svg> <span>留言板</span></a></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-youqinglianjie"></use></svg> <span>链接</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/link/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-friendship"></use></svg> <span>友链</span></a></li><li><a class="site-page child faa-parent animated-hover" target="_blank" rel="noopener" href="https://vercel.dingzh.cc"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-internethulianwangwangluo"></use></svg> <span>镜像</span></a></li><li><a class="site-page child faa-parent animated-hover" href="https://dingzh.cc"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-vpszhujifuwuqiwangluo"></use></svg> <span>主站</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/about/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-wode2"></use></svg> <span>关于</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image:url(https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover57.jpg)"><nav id="nav"><span id="blog_name"><a id="site-name" onclick="btf.scrollToDest(0,500)" data-title="当初自学Java写的一个结课作业，由于Swing太过时了没什么价值，但和之后Web的学习其实有很多相似之处的，蛮摆上来">用Swing和MySQL做一个学生管理系统</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search faa-parent animated-hover"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-sousuo4"></use></svg> <span>搜索</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-shouye"></use></svg> <span>首页</span></a></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-zixun"></use></svg> <span>文章</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/archives/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-danganku"></use></svg> <span>归档</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/tags/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-biaoqian"></use></svg> <span>标签</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/categories/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-wenjianjia"></use></svg> <span>分类</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-guochandonghuatuijian"></use></svg> <span>动漫</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/anime/tv/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-anime"></use></svg> <span>季度</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/anime/collect/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-vpszhujifuwuqiwangluo"></use></svg> <span>藏馆</span></a></li><li><a class="site-page child faa-parent animated-hover" target="_blank" rel="noopener" href="https://github.com/rplalala/MySubTittle"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-dianying"></use></svg> <span>字幕</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-switch2"></use></svg> <span>其他</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/gallery/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-xiangce"></use></svg> <span>图库</span></a></li><li><a class="site-page child faa-parent animated-hover" href="/artitalk/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-pinglun1"></use></svg> <span>随言</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/messageboard/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-rili"></use></svg> <span>留言板</span></a></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="javascript:void(0);"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-youqinglianjie"></use></svg> <span>链接</span><i class="fas fa-chevron-down expand"></i></a><ul class="menus_item_child"><li><a class="site-page child faa-parent animated-hover" href="/link/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-friendship"></use></svg> <span>友链</span></a></li><li><a class="site-page child faa-parent animated-hover" target="_blank" rel="noopener" href="https://vercel.dingzh.cc"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-internethulianwangwangluo"></use></svg> <span>镜像</span></a></li><li><a class="site-page child faa-parent animated-hover" href="https://dingzh.cc"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-a-vpszhujifuwuqiwangluo"></use></svg> <span>主站</span></a></li></ul></div><div class="menus_item"><a class="site-page faa-parent animated-hover" href="/about/"><svg class="icon faa-tada" aria-hidden="true"><use xlink:href="#icon-wode2"></use></svg> <span>关于</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">用Swing和MySQL做一个学生管理系统<a class="post-edit-link" href="https://github.com/rplalala/BlogSource/edit/main/source/_posts/用Swing和MySQL做一个学生管理系统.md" title="编辑" target="_blank"><i class="fas fa-pencil-alt"></i></a></h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">发表于</span><time class="post-meta-date-created" datetime="2022-02-17T10:53:02.000Z" title="发表于 2022-02-17 18:53:02">2022-02-17</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">更新于</span><time class="post-meta-date-updated" datetime="2025-08-02T12:43:16.794Z" title="更新于 2025-08-02 20:43:16">2025-08-02</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/Java/">Java</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">字数总计:</span><span class="word-count">3.8k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">阅读时长:</span><span>16分钟</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" data-flag-title="用Swing和MySQL做一个学生管理系统"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">阅读量:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><h1 id="要求"><a href="#要求" class="headerlink" title="要求"></a>要求</h1><ul><li>MySQL 5.7</li><li>JDK8</li></ul><h1 id="界面展示"><a href="#界面展示" class="headerlink" title="界面展示"></a>界面展示</h1><h2 id="登录界面"><a href="#登录界面" class="headerlink" title="登录界面"></a>登录界面</h2><ol><li>利用主管理员 <code>admin</code> 登录可以对学生和管理员都进行操作</li><li>其余管理员登录只能对学生进行操作</li></ol><p><img src="" data-lazy-src="https://img-blog.csdnimg.cn/20210605152027585.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1JQMTIzMTIzMTIz,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"></p><h2 id="主管理员功能选择界面"><a href="#主管理员功能选择界面" class="headerlink" title="主管理员功能选择界面"></a>主管理员功能选择界面</h2><p><img src="" data-lazy-src="https://img-blog.csdnimg.cn/20210605152307221.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1JQMTIzMTIzMTIz,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"></p><h2 id="操作管理员界面"><a href="#操作管理员界面" class="headerlink" title="操作管理员界面"></a>操作管理员界面</h2><p><img src="" data-lazy-src="https://alicdn.dingzh.cc/img/202202171935783.png" alt=""></p><p><img src="" data-lazy-src="https://alicdn.dingzh.cc/img/202202171934578.png" alt=""></p><h2 id="操作学生界面"><a href="#操作学生界面" class="headerlink" title="操作学生界面"></a>操作学生界面</h2><p><img src="" data-lazy-src="https://img-blog.csdnimg.cn/20210605152458800.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1JQMTIzMTIzMTIz,size_16,color_FFFFFF,t_70" alt="在这里插入图片描述"></p><p><img src="" data-lazy-src="https://alicdn.dingzh.cc/img/202202171933247.png" alt=""></p><p><img src="" data-lazy-src="https://alicdn.dingzh.cc/img/202202171933316.png" alt=""></p><h1 id="部分代码展示"><a href="#部分代码展示" class="headerlink" title="部分代码展示"></a>部分代码展示</h1><h2 id="生成大量学生表"><a href="#生成大量学生表" class="headerlink" title="生成大量学生表"></a>生成大量学生表</h2><p><img src="" data-lazy-src="https://alicdn.dingzh.cc/img/202202171906817.png" alt=""></p><h3 id="InsertStudentData类"><a href="#InsertStudentData类" class="headerlink" title="InsertStudentData类"></a>InsertStudentData类</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> insertStudentData;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.sql.Connection;</span><br><span class="line"><span class="keyword">import</span> java.sql.DriverManager;</span><br><span class="line"><span class="keyword">import</span> java.sql.PreparedStatement;</span><br><span class="line"><span class="keyword">import</span> java.sql.SQLException;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 此类用来随机生成2000条学生数据并插入MySQL数据库，利用批处理</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">InsertStudentData</span> </span>&#123;</span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> </span>&#123;</span><br><span class="line">        RandInfo rand = <span class="keyword">new</span> RandInfo();</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            Class.forName(<span class="string">&quot;com.mysql.jdbc.Driver&quot;</span>);</span><br><span class="line">            Connection connection = DriverManager.getConnection(<span class="string">&quot;jdbc:mysql://localhost:3306/&quot;</span></span><br><span class="line">                    + <span class="string">&quot;studentmanager?useSSL=false&amp;characterEncoding=utf8&quot;</span>, <span class="string">&quot;root&quot;</span>, <span class="string">&quot;123456&quot;</span>);</span><br><span class="line">            connection.setAutoCommit(<span class="keyword">false</span>);<span class="comment">//设置手动提交事务</span></span><br><span class="line">            <span class="keyword">long</span> start = System.currentTimeMillis();</span><br><span class="line">            String sql = <span class="string">&quot;insert into students(id,name,sex,age,class,address) &quot;</span></span><br><span class="line">                    + <span class="string">&quot;values(null,?,?,?,?,?)&quot;</span>;</span><br><span class="line">            PreparedStatement prepareStatement = connection.prepareStatement(sql);</span><br><span class="line">            <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; <span class="number">2000</span>; i++) &#123;</span><br><span class="line">                String[] nameAndSex = rand.getNameAndSex(rand.getSex()); <span class="comment">//得到名字和性别的数组</span></span><br><span class="line">                String familyName = rand.getFamilyName(); <span class="comment">//得到姓氏</span></span><br><span class="line">                String name = nameAndSex[<span class="number">0</span>]; <span class="comment">//根据数组得到名字和性别</span></span><br><span class="line">                String sex = nameAndSex[<span class="number">1</span>];</span><br><span class="line">                String classes = rand.getClasses(); <span class="comment">//得到班级</span></span><br><span class="line">                String address = rand.getAddress(); <span class="comment">//得到住址</span></span><br><span class="line">                <span class="keyword">int</span> age = rand.getAge(); <span class="comment">//得到年龄</span></span><br><span class="line">                prepareStatement.setObject(<span class="number">1</span>, (familyName + name));</span><br><span class="line">                prepareStatement.setObject(<span class="number">2</span>, sex);</span><br><span class="line">                prepareStatement.setObject(<span class="number">3</span>, age);</span><br><span class="line">                prepareStatement.setObject(<span class="number">4</span>, classes);</span><br><span class="line">                prepareStatement.setObject(<span class="number">5</span>, address);</span><br><span class="line">                prepareStatement.addBatch();<span class="comment">//依次将2000个SQL语句提交到命令列表</span></span><br><span class="line">            &#125;</span><br><span class="line">            prepareStatement.executeBatch();<span class="comment">//一次性执行命令列表中的所有SQL语句</span></span><br><span class="line">            connection.commit();<span class="comment">//提交事务，使之前所有的sql命令都生效</span></span><br><span class="line">            <span class="keyword">long</span> end = System.currentTimeMillis();</span><br><span class="line">            System.out.println(<span class="string">&quot;插入了2000条学生数据，共执行了&quot;</span> + (end - start) + <span class="string">&quot;ms&quot;</span>);</span><br><span class="line">            prepareStatement.close();</span><br><span class="line">            connection.close();</span><br><span class="line">        &#125; <span class="keyword">catch</span> (ClassNotFoundException | SQLException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure><h3 id="RandInfo类"><a href="#RandInfo类" class="headerlink" title="RandInfo类"></a>RandInfo类</h3><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> insertStudentData;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.Random;</span><br><span class="line"></span><br><span class="line"><span class="comment">// 随机产生学生信息：name,age,sex,classes,address </span></span><br><span class="line"><span class="comment">// 参考https://blog.csdn.net/yeyu_xing/article/details/108844330</span></span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">RandInfo</span> </span>&#123;</span><br><span class="line">    String familyName1 = <span class="string">&quot;赵钱孙李周吴郑王冯陈褚卫蒋沈韩杨朱秦尤许何吕施张孔曹严华金魏陶姜戚谢邹喻水云苏潘葛奚范彭郎鲁韦昌马苗凤花方俞任袁柳鲍史唐费岑薛雷贺倪汤滕殷罗毕郝邬安常乐于时傅卞齐康伍余元卜顾孟平&quot;</span></span><br><span class="line">            + <span class="string">&quot;黄和穆萧尹姚邵湛汪祁毛禹狄米贝明臧计成戴宋茅庞熊纪舒屈项祝董粱杜阮席季麻强贾路娄危江童颜郭梅盛林刁钟徐邱骆高夏蔡田胡凌霍万柯卢莫房缪干解应宗丁宣邓郁单杭洪包诸左石崔吉&quot;</span></span><br><span class="line">            + <span class="string">&quot;龚程邢滑裴陆荣翁荀羊甄家封芮储靳邴松井富乌焦巴弓牧隗山谷车侯伊宁仇祖武符刘景詹束龙叶幸司韶黎乔苍双闻莘劳逄姬冉宰桂牛寿通边燕冀尚农温庄晏瞿茹习鱼容向古戈终居衡步都耿满弘国文东殴沃曾关红游盖益桓公晋楚闫&quot;</span>;</span><br><span class="line">    String familyName2 = <span class="string">&quot;欧阳太史端木上官司马东方独孤南宫万俟闻人夏侯诸葛尉迟公羊赫连澹台皇甫宗政濮阳公冶太叔申屠公孙慕容仲孙钟离长孙宇文司徒鲜于司空闾丘子车亓官司寇巫马公西颛孙壤驷公良漆雕乐正宰父谷梁拓跋夹谷轩辕令狐段干百里呼延东郭南门羊舌微生公户公玉公仪梁丘公仲公上公门公山公坚左丘公伯西门公祖第五公乘贯丘公皙南荣东里东宫仲长子书子桑即墨达奚褚师吴铭&quot;</span>;</span><br><span class="line">    String girlName = <span class="string">&quot;秀娟英华慧巧美娜静淑惠珠翠雅芝玉萍红娥玲芬芳燕彩春菊兰凤洁梅琳素云莲真环雪荣爱妹霞香月莺媛艳瑞凡佳嘉琼勤珍贞莉桂娣叶璧璐娅琦晶妍茜秋珊莎锦黛青倩婷姣婉娴瑾颖露瑶怡婵雁蓓纨仪荷丹蓉眉君琴蕊薇菁梦岚苑婕馨瑗琰韵融园艺咏卿聪澜纯毓悦昭冰爽琬茗羽希宁欣飘育滢馥筠柔竹霭凝晓欢霄枫芸菲寒伊亚宜可姬舒影荔枝思丽&quot;</span>;</span><br><span class="line">    String boyName = <span class="string">&quot;伟刚勇毅俊峰强军平保东文辉力明永健世广志义兴良海山仁波宁贵福生龙元全国胜学祥才发武新利清飞彬富顺信子杰涛昌成康星光天达安岩中茂进林有坚和彪博诚先敬震振壮会思群豪心邦承乐绍功松善厚庆磊民友裕河哲江超浩亮政谦亨奇固之轮翰朗伯宏言若鸣朋斌梁栋维启克伦翔旭鹏泽晨辰士以建家致树炎德行时泰盛雄琛钧冠策腾楠榕风航弘&quot;</span>;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 功能：随机产生姓氏</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> 姓氏</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getFamilyName</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        String str;</span><br><span class="line">        <span class="keyword">int</span> randNum = <span class="keyword">new</span> Random().nextInt(<span class="number">2</span>) + <span class="number">1</span>;</span><br><span class="line">        <span class="keyword">int</span> strLen = randNum == <span class="number">1</span> ? familyName1.length() : familyName2.length();</span><br><span class="line">        <span class="keyword">int</span> index = <span class="keyword">new</span> Random().nextInt(strLen);</span><br><span class="line">        <span class="keyword">if</span> (randNum == <span class="number">1</span>) &#123;</span><br><span class="line">            str = String.valueOf(familyName1.charAt(index));</span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            str = (index &amp; <span class="number">1</span>) == <span class="number">0</span> ? familyName2.substring(index, index + <span class="number">2</span>) :</span><br><span class="line">                    familyName2.substring(index - <span class="number">1</span>, index + <span class="number">1</span>);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> str;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 功能：随机产生性别</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> 性别</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getSex</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> randNum = <span class="keyword">new</span> Random().nextInt(<span class="number">2</span>) + <span class="number">1</span>;</span><br><span class="line">        <span class="keyword">return</span> randNum == <span class="number">1</span> ? <span class="string">&quot;男&quot;</span> : <span class="string">&quot;女&quot;</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 功能：传入性别参数，依据性别产生名字</span></span><br><span class="line"><span class="comment">     * 返回的数组 ，索引0是名字；索引1是性别</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> sex:性别</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> 返回[名字，性别]</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="keyword">public</span> String[] getNameAndSex(String sex) &#123;</span><br><span class="line">        String[] nameSex = <span class="keyword">new</span> String[<span class="number">2</span>];</span><br><span class="line">        <span class="keyword">int</span> randNum = <span class="keyword">new</span> Random().nextInt(<span class="number">2</span>) + <span class="number">1</span>;</span><br><span class="line">        <span class="keyword">int</span> strLen = sex.equals(<span class="string">&quot;男&quot;</span>) ? boyName.length() : girlName.length();</span><br><span class="line">        <span class="keyword">int</span> index = (randNum &amp; <span class="number">1</span>) == <span class="number">0</span> ? <span class="keyword">new</span> Random().nextInt(strLen - <span class="number">1</span>) :</span><br><span class="line">                <span class="keyword">new</span> Random().nextInt(strLen);</span><br><span class="line">        nameSex[<span class="number">0</span>] = sex.equals(<span class="string">&quot;男&quot;</span>) ? boyName.substring(index, index + randNum) :</span><br><span class="line">                girlName.substring(index, index + randNum);</span><br><span class="line">        nameSex[<span class="number">1</span>] = sex.equals(<span class="string">&quot;男&quot;</span>) ? <span class="string">&quot;男&quot;</span> : <span class="string">&quot;女&quot;</span>;</span><br><span class="line">        <span class="keyword">return</span> nameSex;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 功能：随机产生18-24的整数作为年龄</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> 18-24的整数</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">getAge</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">return</span> (<span class="keyword">int</span>) (Math.random() * <span class="number">7</span> + <span class="number">18</span>);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 功能：随机产生班级(1、2、3、4班)</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> (1 、 2 、 3 、 4班)</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getClasses</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> classId = (<span class="keyword">int</span>) (Math.random() * <span class="number">4</span> + <span class="number">1</span>);</span><br><span class="line"></span><br><span class="line">        <span class="keyword">return</span> classId + <span class="string">&quot;班&quot;</span>;</span><br><span class="line"></span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 功能：随机产生住址 3-8号楼 1-4层</span></span><br><span class="line"><span class="comment">     * 例：401-409 411 - 419 421 - 429 431-439</span></span><br><span class="line"><span class="comment">     * 一房4人，一层30房，4层 则 一栋楼住480人</span></span><br><span class="line"><span class="comment">     * 一共6栋楼，共可以住2880人</span></span><br><span class="line"><span class="comment">     * 格式：8#401</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> x#xxx</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> String <span class="title">getAddress</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        String address;</span><br><span class="line">        <span class="keyword">int</span> buildingId = (<span class="keyword">int</span>) (Math.random() * <span class="number">6</span> + <span class="number">3</span>);<span class="comment">//3-8</span></span><br><span class="line">        <span class="keyword">int</span> floorId = (<span class="keyword">int</span>) (Math.random() * <span class="number">4</span> + <span class="number">1</span>);<span class="comment">//1-4</span></span><br><span class="line">        <span class="keyword">int</span> roomId = (<span class="keyword">int</span>) (Math.random() * <span class="number">39</span> + <span class="number">1</span>);<span class="comment">//1-39</span></span><br><span class="line"></span><br><span class="line">        <span class="keyword">if</span> (roomId &lt; <span class="number">10</span>) &#123;</span><br><span class="line">            address = buildingId + <span class="string">&quot;#&quot;</span> + floorId + <span class="string">&quot;0&quot;</span> + roomId;</span><br><span class="line">        &#125; <span class="keyword">else</span> <span class="keyword">if</span> (roomId &gt;= <span class="number">11</span> &amp;&amp; roomId &lt;= <span class="number">19</span> || roomId &gt;= <span class="number">21</span> &amp;&amp; roomId &lt;= <span class="number">29</span> || roomId &gt;= <span class="number">31</span> &amp;&amp; roomId &lt;= <span class="number">39</span>) &#123;</span><br><span class="line">            address = buildingId + <span class="string">&quot;#&quot;</span> + floorId + (roomId + <span class="string">&quot;&quot;</span>);</span><br><span class="line">        &#125; <span class="keyword">else</span> &#123;</span><br><span class="line">            <span class="comment">//当roomId为10、20、30时，重新赋予一个不为10、20、30随机数</span></span><br><span class="line">            address = getAddress();</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> address;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><h2 id="管理员信息和JDBC配置文件"><a href="#管理员信息和JDBC配置文件" class="headerlink" title="管理员信息和JDBC配置文件"></a>管理员信息和JDBC配置文件</h2><p><img src="" data-lazy-src="https://alicdn.dingzh.cc/img/202202171910783.png" alt=""></p><h3 id="管理员信息"><a href="#管理员信息" class="headerlink" title="管理员信息"></a>管理员信息</h3><p>在管理管理员界面可以对该XML文件进行更改</p><figure class="highlight xml"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br></pre></td><td class="code"><pre><span class="line"><span class="meta">&lt;?xml version=&quot;1.0&quot; encoding=&quot;utf-8&quot;?&gt;</span></span><br><span class="line"></span><br><span class="line"><span class="tag">&lt;<span class="name">Admins</span>&gt;</span> </span><br><span class="line">  <span class="tag">&lt;<span class="name">Admin</span>&gt;</span> </span><br><span class="line">    <span class="tag">&lt;<span class="name">userName</span>&gt;</span>admin<span class="tag">&lt;/<span class="name">userName</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">userPassword</span>&gt;</span>admin<span class="tag">&lt;/<span class="name">userPassword</span>&gt;</span> </span><br><span class="line">  <span class="tag">&lt;/<span class="name">Admin</span>&gt;</span>  </span><br><span class="line">  <span class="tag">&lt;<span class="name">Admin</span>&gt;</span> </span><br><span class="line">    <span class="tag">&lt;<span class="name">userName</span>&gt;</span>zhangsan<span class="tag">&lt;/<span class="name">userName</span>&gt;</span>  </span><br><span class="line">    <span class="tag">&lt;<span class="name">userPassword</span>&gt;</span>zhangsan123<span class="tag">&lt;/<span class="name">userPassword</span>&gt;</span> </span><br><span class="line">  <span class="tag">&lt;/<span class="name">Admin</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;<span class="name">Admin</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">userName</span>&gt;</span>nihao<span class="tag">&lt;/<span class="name">userName</span>&gt;</span></span><br><span class="line">    <span class="tag">&lt;<span class="name">userPassword</span>&gt;</span>nihao123<span class="tag">&lt;/<span class="name">userPassword</span>&gt;</span></span><br><span class="line">  <span class="tag">&lt;/<span class="name">Admin</span>&gt;</span></span><br><span class="line"><span class="tag">&lt;/<span class="name">Admins</span>&gt;</span></span><br><span class="line"></span><br></pre></td></tr></table></figure><h3 id="JDBC配置文件"><a href="#JDBC配置文件" class="headerlink" title="JDBC配置文件"></a>JDBC配置文件</h3><p>用properties文件储存JDBC信息，便于修改</p><figure class="highlight properties"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br></pre></td><td class="code"><pre><span class="line"><span class="attr">mysqlDriver</span>=<span class="string">com.mysql.jdbc.Driver</span></span><br><span class="line"><span class="attr">mysqlUrl</span>=<span class="string">jdbc:mysql://localhost:3306/studentmanager?useSSL=false&amp;characterEncoding=utf8</span></span><br><span class="line"><span class="attr">mysqlUser</span>=<span class="string">root</span></span><br><span class="line"><span class="attr">mysqlPwd</span>=<span class="string">123456</span></span><br></pre></td></tr></table></figure><h2 id="基本结构"><a href="#基本结构" class="headerlink" title="基本结构"></a>基本结构</h2><p><img src="" data-lazy-src="https://alicdn.dingzh.cc/img/202202171914307.png" alt=""></p><ul><li><code>dao包</code>：主要实现增删查改的接口</li><li><code>entity包</code>：学生信息和管理员信息类</li><li><code>main包</code>：执行类</li><li><code>ui包</code>：各界面Swing构造类</li><li><code>utils包</code>：各个辅助类</li></ul><div class="note info no-icon simple"><p>由于代码复用性低，且量比较多，我就不往上贴了<br>只贴一下复用性较高的辅助类代码</p></div><h3 id="DBUtils类"><a href="#DBUtils类" class="headerlink" title="DBUtils类"></a>DBUtils类</h3><p><strong>JDBC辅助类</strong><br></p><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ding.utils;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.FileReader;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.sql.*;</span><br><span class="line"><span class="keyword">import</span> java.util.*;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">DBUtils</span> </span>&#123;</span><br><span class="line">    <span class="keyword">private</span> Connection connection = <span class="keyword">null</span>;</span><br><span class="line">    <span class="keyword">private</span> PreparedStatement preparedStatement = <span class="keyword">null</span>;</span><br><span class="line">    <span class="keyword">private</span> ResultSet resultSet = <span class="keyword">null</span>;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">static</span> Properties properties = <span class="keyword">null</span>;<span class="comment">//存放mysql连接信息的配置文件</span></span><br><span class="line"></span><br><span class="line">    <span class="comment">//加载驱动</span></span><br><span class="line">    <span class="keyword">static</span> &#123;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            <span class="comment">//实例化配置文件信息</span></span><br><span class="line">            properties = <span class="keyword">new</span> Properties();</span><br><span class="line">            properties.load(<span class="keyword">new</span> FileReader(<span class="string">&quot;entity/JDBC.properties&quot;</span>));</span><br><span class="line">            <span class="comment">//利用配置文件加载数据库</span></span><br><span class="line">            Class.forName(properties.getProperty(<span class="string">&quot;mysqlDriver&quot;</span>));</span><br><span class="line">        &#125; <span class="keyword">catch</span> (ClassNotFoundException | IOException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 获取连接</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">getConnection</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            String url = properties.getProperty(<span class="string">&quot;mysqlUrl&quot;</span>);</span><br><span class="line">            String userName = properties.getProperty(<span class="string">&quot;mysqlUser&quot;</span>);</span><br><span class="line">            String userPassword = properties.getProperty(<span class="string">&quot;mysqlPwd&quot;</span>);</span><br><span class="line">            connection = DriverManager.getConnection(url, userName, userPassword);</span><br><span class="line">        &#125; <span class="keyword">catch</span> (SQLException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 关闭各连接</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">close</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            <span class="keyword">if</span> (resultSet != <span class="keyword">null</span>) &#123;</span><br><span class="line">                resultSet.close();</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">if</span> (resultSet != <span class="keyword">null</span>) &#123;</span><br><span class="line">                preparedStatement.close();</span><br><span class="line">            &#125;</span><br><span class="line">            <span class="keyword">if</span> (resultSet != <span class="keyword">null</span>) &#123;</span><br><span class="line">                connection.close();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125; <span class="keyword">catch</span> (SQLException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 更新操作</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> sql 查询sql语句</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> obj sql语句中各占位符对应的值</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> 更新的行数(若为DDL语句 ， 因没有操作行 ， 则默认返回0)</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">int</span> <span class="title">update</span><span class="params">(String sql, Object[] obj)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">int</span> row = -<span class="number">1</span>;</span><br><span class="line">        getConnection();</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            preparedStatement = connection.prepareStatement(sql);</span><br><span class="line">            <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; obj.length; i++) &#123;</span><br><span class="line">                preparedStatement.setObject(i + <span class="number">1</span>, obj[i]);</span><br><span class="line">            &#125;</span><br><span class="line">            row = preparedStatement.executeUpdate();</span><br><span class="line">        &#125; <span class="keyword">catch</span> (SQLException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">            close();</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> row;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 查询操作</span></span><br><span class="line"><span class="comment">     *</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> sql 查询sql语句</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@param</span> obj sql语句中各占位符对应的值</span></span><br><span class="line"><span class="comment">     * <span class="doctag">@return</span> List&lt;Map &lt; String, String&gt;&gt;(储存查询到的学生信息)</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="keyword">public</span> List&lt;Map&lt;String, String&gt;&gt; query(String sql, Object[] obj) &#123;</span><br><span class="line">        List&lt;Map&lt;String, String&gt;&gt; list = <span class="keyword">new</span> ArrayList&lt;&gt;();</span><br><span class="line">        getConnection();</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            preparedStatement = connection.prepareStatement(sql);</span><br><span class="line">            <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; obj.length; i++) &#123;</span><br><span class="line">                preparedStatement.setObject(i + <span class="number">1</span>, obj[i]);</span><br><span class="line">            &#125;</span><br><span class="line">            resultSet = preparedStatement.executeQuery();</span><br><span class="line">            <span class="keyword">while</span> (resultSet.next()) &#123;</span><br><span class="line">                Map&lt;String, String&gt; map = <span class="keyword">new</span> HashMap&lt;&gt;();</span><br><span class="line">                ResultSetMetaData resultSetMetaData = resultSet.getMetaData();</span><br><span class="line">                <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">1</span>; i &lt;= resultSetMetaData.getColumnCount(); i++) &#123;</span><br><span class="line">                    String columnName = resultSetMetaData.getColumnName(i);<span class="comment">//按顺序获取表的列名</span></span><br><span class="line">                    map.put(columnName, resultSet.getString(columnName));</span><br><span class="line">                &#125;</span><br><span class="line">                list.add(map);</span><br><span class="line">            &#125;</span><br><span class="line"></span><br><span class="line">        &#125; <span class="keyword">catch</span> (SQLException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">            close();</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> list;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br></pre></td></tr></table></figure><p></p><h3 id="RegExpHelp"><a href="#RegExpHelp" class="headerlink" title="RegExpHelp"></a>RegExpHelp</h3><p><strong>正则表达式辅助类</strong><br></p><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ding.utils;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.util.regex.Matcher;</span><br><span class="line"><span class="keyword">import</span> java.util.regex.Pattern;</span><br><span class="line"></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">RegExpHelp</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 判断 待检测的字符串s 是否满足 正则表达式regEx</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">checkRegexp</span><span class="params">(String regEx, String s)</span> </span>&#123;</span><br><span class="line">        Pattern pattern = Pattern.compile(regEx);</span><br><span class="line">        Matcher matcher = pattern.matcher(s);</span><br><span class="line">        <span class="keyword">return</span> matcher.matches();</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 正则表达式检验：输入的是否是 m-n 位的非0正整数</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">notZeroAndPositiveAndLimitDigit</span><span class="params">(String s, <span class="keyword">int</span> m, <span class="keyword">int</span> n)</span> </span>&#123;</span><br><span class="line">        String regEx1 = <span class="string">&quot;^\\+?[1-9][0-9]*$&quot;</span>;<span class="comment">//字符串只能为非0的正整数</span></span><br><span class="line">        String regEx2 = <span class="string">&quot;^\\d&#123;&quot;</span> + m + <span class="string">&quot;,&quot;</span> + n + <span class="string">&quot;&#125;$&quot;</span>;<span class="comment">//字符串只能为m-n位数字</span></span><br><span class="line">        <span class="keyword">boolean</span> judge1 = checkRegexp(regEx1, s);<span class="comment">//判断是否满足 非0的正整数</span></span><br><span class="line">        <span class="keyword">boolean</span> judge2 = checkRegexp(regEx2, s);<span class="comment">//判断是否满足 m-n位的数字</span></span><br><span class="line">        <span class="keyword">return</span> (judge1 &amp;&amp; judge2); <span class="comment">//判断是否满足 m-n位的非0正整数;</span></span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 正则表达式检验：第一位 1-4 ；第二位 0-3；第三位1-9；格式的3位数房间号</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">formatRoomNum</span><span class="params">(String s)</span> </span>&#123;</span><br><span class="line">        String regEx = <span class="string">&quot;^[1-4][0-3][1-9]$&quot;</span>;<span class="comment">//房间号格式</span></span><br><span class="line">        <span class="keyword">return</span> checkRegexp(regEx, s);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 正则表达式检验：输入的是否是 2-4位汉字</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">formatChinese</span><span class="params">(String s)</span> </span>&#123;</span><br><span class="line">        String regEx = <span class="string">&quot;^[\\u4e00-\\u9fa5]&#123;2,4&#125;$&quot;</span>;</span><br><span class="line">        <span class="keyword">return</span> checkRegexp(regEx, s);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 正则表达式检验：字母开头，5-16字节，允许字母数字下划线</span></span><br><span class="line"><span class="comment">     * 用来检验管理员账号和密码</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">checkUserNameAndUserPassword</span><span class="params">(String s)</span> </span>&#123;</span><br><span class="line">        String regEx = <span class="string">&quot;^[a-zA-Z][a-zA-Z0-9_]&#123;4,15&#125;$&quot;</span>;</span><br><span class="line">        <span class="keyword">return</span> checkRegexp(regEx, s);</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure><p></p><h3 id="XMLUtils"><a href="#XMLUtils" class="headerlink" title="XMLUtils"></a>XMLUtils</h3><p><strong>XML辅助类</strong><br></p><figure class="highlight java"><table><tr><td class="gutter"><pre><span class="line">1</span><br><span class="line">2</span><br><span class="line">3</span><br><span class="line">4</span><br><span class="line">5</span><br><span class="line">6</span><br><span class="line">7</span><br><span class="line">8</span><br><span class="line">9</span><br><span class="line">10</span><br><span class="line">11</span><br><span class="line">12</span><br><span class="line">13</span><br><span class="line">14</span><br><span class="line">15</span><br><span class="line">16</span><br><span class="line">17</span><br><span class="line">18</span><br><span class="line">19</span><br><span class="line">20</span><br><span class="line">21</span><br><span class="line">22</span><br><span class="line">23</span><br><span class="line">24</span><br><span class="line">25</span><br><span class="line">26</span><br><span class="line">27</span><br><span class="line">28</span><br><span class="line">29</span><br><span class="line">30</span><br><span class="line">31</span><br><span class="line">32</span><br><span class="line">33</span><br><span class="line">34</span><br><span class="line">35</span><br><span class="line">36</span><br><span class="line">37</span><br><span class="line">38</span><br><span class="line">39</span><br><span class="line">40</span><br><span class="line">41</span><br><span class="line">42</span><br><span class="line">43</span><br><span class="line">44</span><br><span class="line">45</span><br><span class="line">46</span><br><span class="line">47</span><br><span class="line">48</span><br><span class="line">49</span><br><span class="line">50</span><br><span class="line">51</span><br><span class="line">52</span><br><span class="line">53</span><br><span class="line">54</span><br><span class="line">55</span><br><span class="line">56</span><br><span class="line">57</span><br><span class="line">58</span><br><span class="line">59</span><br><span class="line">60</span><br><span class="line">61</span><br><span class="line">62</span><br><span class="line">63</span><br><span class="line">64</span><br><span class="line">65</span><br><span class="line">66</span><br><span class="line">67</span><br><span class="line">68</span><br><span class="line">69</span><br><span class="line">70</span><br><span class="line">71</span><br><span class="line">72</span><br><span class="line">73</span><br><span class="line">74</span><br><span class="line">75</span><br><span class="line">76</span><br><span class="line">77</span><br><span class="line">78</span><br><span class="line">79</span><br><span class="line">80</span><br><span class="line">81</span><br><span class="line">82</span><br><span class="line">83</span><br><span class="line">84</span><br><span class="line">85</span><br><span class="line">86</span><br><span class="line">87</span><br><span class="line">88</span><br><span class="line">89</span><br><span class="line">90</span><br><span class="line">91</span><br><span class="line">92</span><br><span class="line">93</span><br><span class="line">94</span><br><span class="line">95</span><br><span class="line">96</span><br><span class="line">97</span><br><span class="line">98</span><br><span class="line">99</span><br><span class="line">100</span><br><span class="line">101</span><br><span class="line">102</span><br><span class="line">103</span><br><span class="line">104</span><br><span class="line">105</span><br><span class="line">106</span><br><span class="line">107</span><br><span class="line">108</span><br><span class="line">109</span><br><span class="line">110</span><br><span class="line">111</span><br><span class="line">112</span><br><span class="line">113</span><br><span class="line">114</span><br><span class="line">115</span><br><span class="line">116</span><br><span class="line">117</span><br><span class="line">118</span><br><span class="line">119</span><br><span class="line">120</span><br><span class="line">121</span><br><span class="line">122</span><br><span class="line">123</span><br><span class="line">124</span><br><span class="line">125</span><br><span class="line">126</span><br><span class="line">127</span><br><span class="line">128</span><br><span class="line">129</span><br><span class="line">130</span><br><span class="line">131</span><br><span class="line">132</span><br><span class="line">133</span><br><span class="line">134</span><br><span class="line">135</span><br><span class="line">136</span><br><span class="line">137</span><br><span class="line">138</span><br><span class="line">139</span><br><span class="line">140</span><br><span class="line">141</span><br><span class="line">142</span><br><span class="line">143</span><br><span class="line">144</span><br><span class="line">145</span><br><span class="line">146</span><br><span class="line">147</span><br><span class="line">148</span><br><span class="line">149</span><br><span class="line">150</span><br><span class="line">151</span><br><span class="line">152</span><br><span class="line">153</span><br><span class="line">154</span><br><span class="line">155</span><br><span class="line">156</span><br><span class="line">157</span><br><span class="line">158</span><br><span class="line">159</span><br><span class="line">160</span><br><span class="line">161</span><br><span class="line">162</span><br><span class="line">163</span><br><span class="line">164</span><br><span class="line">165</span><br></pre></td><td class="code"><pre><span class="line"><span class="keyword">package</span> com.ding.utils;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.dom4j.Document;</span><br><span class="line"><span class="keyword">import</span> org.dom4j.DocumentException;</span><br><span class="line"><span class="keyword">import</span> org.dom4j.Element;</span><br><span class="line"><span class="keyword">import</span> org.dom4j.io.OutputFormat;</span><br><span class="line"><span class="keyword">import</span> org.dom4j.io.SAXReader;</span><br><span class="line"><span class="keyword">import</span> org.dom4j.io.XMLWriter;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.FileWriter;</span><br><span class="line"><span class="keyword">import</span> java.io.IOException;</span><br><span class="line"><span class="keyword">import</span> java.util.*;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * 方法1,2是对xml的解析辅助，适用于任何情况</span></span><br><span class="line"><span class="comment"> * xml读取操作一般分为：</span></span><br><span class="line"><span class="comment"> * 解析 -&gt; 操作</span></span><br><span class="line"><span class="comment"> * xml更新操作一般分为：</span></span><br><span class="line"><span class="comment"> * 解析 -&gt; 操作 -&gt;写入</span></span><br><span class="line"><span class="comment"> * 其中 解析 和 写入 可以通过其帮你完成，操作 可以自己撰写</span></span><br><span class="line"><span class="comment"> * 用方法1,2和自己撰写的中间操作就可以完成对xml的所有操作</span></span><br><span class="line"><span class="comment"> * &lt;p&gt;</span></span><br><span class="line"><span class="comment"> * 方法3,4,5,6是对xml的读取、新增、修改、删除操作。</span></span><br><span class="line"><span class="comment"> * 根据不同的xml文件和项目要求，需要对 方法进行一定的修改。</span></span><br><span class="line"><span class="comment"> * 仅供参考，必要时自己撰写中间操作</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">XMLUtils</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="keyword">private</span> String pathName; <span class="comment">//xml文件所在路径</span></span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">XMLUtils</span><span class="params">()</span> </span>&#123;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">//在构造XMLUtils对象时，传入xml文件所在路径pathName</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="title">XMLUtils</span><span class="params">(String pathName)</span> </span>&#123;</span><br><span class="line">        <span class="keyword">this</span>.pathName = pathName;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 1</span></span><br><span class="line"><span class="comment">     * 解析XML文件，得到document对象</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> Document <span class="title">xmlParse</span><span class="params">()</span> </span>&#123;</span><br><span class="line">        <span class="comment">// 创建DOM4J解析器</span></span><br><span class="line">        SAXReader saxReader = <span class="keyword">new</span> SAXReader();</span><br><span class="line">        Document document = <span class="keyword">null</span>;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 通过解析器去解读XML文件</span></span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            document = saxReader.read(pathName);</span><br><span class="line">        &#125; <span class="keyword">catch</span> (DocumentException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> document;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 2</span></span><br><span class="line"><span class="comment">     * 把对document的操作写入xml文档</span></span><br><span class="line"><span class="comment">     * document：通过解析XML文件，获得的document对象</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">void</span> <span class="title">xmlWrite</span><span class="params">(Document document)</span> </span>&#123;</span><br><span class="line">        <span class="comment">// 格式化输出</span></span><br><span class="line">        OutputFormat of = OutputFormat.createPrettyPrint();</span><br><span class="line">        of.setEncoding(<span class="string">&quot;utf-8&quot;</span>);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 写入的操作</span></span><br><span class="line">        XMLWriter xmlWriter = <span class="keyword">null</span>;</span><br><span class="line">        <span class="keyword">try</span> &#123;</span><br><span class="line">            xmlWriter = <span class="keyword">new</span> XMLWriter(<span class="keyword">new</span> FileWriter(pathName), of);</span><br><span class="line">            xmlWriter.write(document);<span class="comment">//将document的操作写入pathName路径下的xml文档</span></span><br><span class="line">        &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">            e.printStackTrace();</span><br><span class="line">        &#125; <span class="keyword">finally</span> &#123;</span><br><span class="line">            <span class="keyword">try</span> &#123;</span><br><span class="line">                <span class="keyword">if</span> (xmlWriter != <span class="keyword">null</span>) &#123;</span><br><span class="line">                    xmlWriter.close();</span><br><span class="line">                &#125;</span><br><span class="line">            &#125; <span class="keyword">catch</span> (IOException e) &#123;</span><br><span class="line">                e.printStackTrace();</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 3</span></span><br><span class="line"><span class="comment">     * 读取xml数据</span></span><br><span class="line"><span class="comment">     * 返回List&lt;Element&gt;集合</span></span><br><span class="line"><span class="comment">     * 需要根据xml文档更改，并不是写死的</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="keyword">public</span> List&lt;Map&lt;String, String&gt;&gt; xmlRead(Document document) &#123;</span><br><span class="line">        List&lt;Element&gt; nodes = document.selectNodes(<span class="string">&quot;/Admins/Admin&quot;</span>);<span class="comment">//需要看情况修改</span></span><br><span class="line">        List&lt;Map&lt;String, String&gt;&gt; list = <span class="keyword">new</span> ArrayList&lt;&gt;();</span><br><span class="line">        <span class="keyword">for</span> (Element node : nodes) &#123;</span><br><span class="line">            Map&lt;String, String&gt; map = <span class="keyword">new</span> HashMap&lt;&gt;();</span><br><span class="line">            map.put(<span class="string">&quot;userName&quot;</span>, node.elementText(<span class="string">&quot;userName&quot;</span>));<span class="comment">//需要看情况修改</span></span><br><span class="line">            map.put(<span class="string">&quot;userPassword&quot;</span>, node.elementText(<span class="string">&quot;userPassword&quot;</span>));<span class="comment">//需要看情况修改</span></span><br><span class="line">            list.add(map);</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> list;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 4</span></span><br><span class="line"><span class="comment">     * 添加xml数据</span></span><br><span class="line"><span class="comment">     * values：给xml中key对应的value添加的值</span></span><br><span class="line"><span class="comment">     * 需要根据xml文档更改，并不是写死的</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">xmlAdd</span><span class="params">(Document document, String[] values)</span> </span>&#123;</span><br><span class="line">        Element rootNode = document.getRootElement();</span><br><span class="line">        Element childNode = rootNode.addElement(<span class="string">&quot;Admin&quot;</span>);<span class="comment">//需要看情况修改</span></span><br><span class="line">        String[] keys = &#123;<span class="string">&quot;userName&quot;</span>, <span class="string">&quot;userPassword&quot;</span>&#125;;<span class="comment">//需要看情况修改</span></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; keys.length; i++) &#123;</span><br><span class="line">            childNode.addElement(keys[i]).addText(values[i]);</span><br><span class="line">        &#125;</span><br><span class="line">        xmlWrite(document);<span class="comment">//执行写入操作</span></span><br><span class="line">        <span class="keyword">return</span> <span class="keyword">true</span>;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 5</span></span><br><span class="line"><span class="comment">     * 修改xml数据</span></span><br><span class="line"><span class="comment">     * 返回是否修改成功(xml中是否有满足修改条件的数据)</span></span><br><span class="line"><span class="comment">     * values：给xml中key对应的value修改的值</span></span><br><span class="line"><span class="comment">     * userName：需要修改的管理员 的用户名</span></span><br><span class="line"><span class="comment">     * 需要根据xml文档更改，并不是写死的</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">xmlUpdate</span><span class="params">(Document document, String[] values, String userName)</span> </span>&#123;</span><br><span class="line">        List&lt;Element&gt; nodes = document.selectNodes(<span class="string">&quot;/Admins/Admin&quot;</span>);<span class="comment">//需要看情况修改</span></span><br><span class="line">        <span class="keyword">boolean</span> judge = <span class="keyword">false</span>;</span><br><span class="line">        <span class="keyword">for</span> (Element node : nodes) &#123;</span><br><span class="line">            <span class="keyword">if</span> (node.elementText(<span class="string">&quot;userName&quot;</span>).equals(userName)) &#123;<span class="comment">//需要看情况修改</span></span><br><span class="line">                judge = <span class="keyword">true</span>;</span><br><span class="line">                node.element(<span class="string">&quot;userName&quot;</span>).setText(values[<span class="number">0</span>]);<span class="comment">//需要看情况修改</span></span><br><span class="line">                node.element(<span class="string">&quot;userPassword&quot;</span>).setText(values[<span class="number">1</span>]);<span class="comment">//需要看情况修改</span></span><br><span class="line">                xmlWrite(document);<span class="comment">//执行写入操作</span></span><br><span class="line">                <span class="keyword">break</span>;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> judge;</span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">     * 6</span></span><br><span class="line"><span class="comment">     * 删除xml数据</span></span><br><span class="line"><span class="comment">     * 返回是否删除成功(xml中是否有满足删除条件的数据)</span></span><br><span class="line"><span class="comment">     * userName：需要修改的管理员 的用户名</span></span><br><span class="line"><span class="comment">     * 需要根据xml文档更改，并不是写死的</span></span><br><span class="line"><span class="comment">     */</span></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">boolean</span> <span class="title">xmlDelete</span><span class="params">(Document document, String userName)</span> </span>&#123;</span><br><span class="line">        List&lt;Element&gt; nodes = document.selectNodes(<span class="string">&quot;/Admins/Admin&quot;</span>);<span class="comment">//需要看情况修改</span></span><br><span class="line">        <span class="keyword">boolean</span> judge = <span class="keyword">false</span>;</span><br><span class="line">        <span class="keyword">for</span> (Element node : nodes) &#123;</span><br><span class="line">            <span class="keyword">if</span> (node.elementText(<span class="string">&quot;userName&quot;</span>).equals(userName)) &#123;<span class="comment">//需要看情况修改</span></span><br><span class="line">                judge = <span class="keyword">true</span>;</span><br><span class="line">                node.getParent().remove(node);<span class="comment">//删除该节点</span></span><br><span class="line">                xmlWrite(document);<span class="comment">//执行写入操作</span></span><br><span class="line">                <span class="keyword">break</span>;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">        <span class="keyword">return</span> judge;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure><p></p><h1 id="生成-exe可执行文件"><a href="#生成-exe可执行文件" class="headerlink" title="生成.exe可执行文件"></a>生成<code>.exe</code>可执行文件</h1><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/qlh2561808384/article/details/107730692">IntelliJ的方法</a>：看到生成jar包那一步就可以了，exe4j的操作有错</p><p><a target="_blank" rel="noopener" href="https://blog.csdn.net/Code_Boy_Code/article/details/88052421">Eclipse的方法</a>：生成jar包和exe4j的操作看这个就行了</p><p>可能遇到的问题</p><ol><li><code>.exe</code>文件的图标<code>.ico</code>文件不能由<code>.jpg</code>、<code>.png</code>文件改后缀名得到。<br>可以利用<a target="_blank" rel="noopener" href="https://www.bitbug.net/">.ico文件转换网址</a>来得到<code>.ico</code>文件</li><li>若有项目中有图片、配置文件等需要从本地读取的信息，应该把这些文件放到与<code>.exe</code>文件同一目录下。</li></ol><p><img src="" data-lazy-src="https://img-blog.csdnimg.cn/20210605151537793.png" alt="在这里插入图片描述"></p></article><div class="post-copyright"><div class="post-copyright__title"><span class="post-copyright-info"><h>用Swing和MySQL做一个学生管理系统</h></span></div><div class="post-copyright__type"><span class="post-copyright-info"><a href="https://dingzh.cc/posts/1e5fbfe0.html">https://dingzh.cc/posts/1e5fbfe0.html</a></span></div><div class="post-copyright-m"><div class="post-copyright-m-info"><div class="post-copyright-a"><h>作者</h><div class="post-copyright-cc-info"><h>Dingzh</h></div></div><div class="post-copyright-c"><h>发布于</h><div class="post-copyright-cc-info"><h>2022-02-17</h></div></div><div class="post-copyright-u"><h>更新于</h><div class="post-copyright-cc-info"><h>2025-08-02</h></div></div><div class="post-copyright-c"><h>许可协议</h><div class="post-copyright-cc-info"><a class="icon" rel="noopener" target="_blank" title="Creative Commons" href="https://creativecommons.org/"><i class="fab fa-creative-commons"></i></a><a rel="noopener" target="_blank" title="CC BY-NC-SA 4.0" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a></div></div></div></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Java/">Java</a><a class="post-meta__tags" href="/tags/MySQL/">MySQL</a></div><div class="post_share"><div class="social-share" data-image="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover57.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://npm.elemecdn.com/social-share.js/dist/css/share.min.css" media="print" onload='this.media="all"'><script src="https://npm.elemecdn.com/social-share.js/dist/js/social-share.min.js" defer></script></div></div><div class="post-reward"><div class="reward-button button--animated"><i class="fas fa-qrcode"></i> 打赏<div class="reward-main"><ul class="reward-all"><li class="reward-item"><a href="https://alicdn.dingzh.cc/ding-BlogDemo/img/wechat.jpg" target="_blank"><img class="post-qr-code-img" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/wechat.jpg" alt="微信"></a><div class="post-qr-code-desc">微信</div></li><li class="reward-item"><a href="https://alicdn.dingzh.cc/ding-BlogDemo/img/alipay.jpg" target="_blank"><img class="post-qr-code-img" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/alipay.jpg" alt="支付宝"></a><div class="post-qr-code-desc">支付宝</div></li></ul></div></div></div><nav class="pagination-post" id="pagination"><div class="prev-post pull-left"><a href="/posts/6290ea25.html"><img class="prev-cover" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover108.jpg" onerror='onerror=null,src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="cover of previous post"><div class="pagination-info"><div class="label">上一篇</div><div class="prev_info">Python实现批量对文件按时间进行重命名</div></div></a></div><div class="next-post pull-right"><a href="/posts/2fafc5f1.html"><img class="next-cover" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover284.jpg" onerror='onerror=null,src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="cover of next post"><div class="pagination-info"><div class="label">下一篇</div><div class="next_info">MySQL解决删除数据后，自增id的断层问题</div></div></a></div></nav><hr><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i> <span>评论</span></div></div><div class="comment-wrap"><div><div id="twikoo-wrap"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/head1.jpg" onerror='this.onerror=null,this.src="https://alicdn.dingzh.cc/ding-BlogDemo/img/imgLink_404.gif"' alt="avatar"></div><div class="author-info__name">Dingzh</div><div class="author-info__description">为之则易，不为则难</div></div><div class="card-info-data"><div class="card-info-data-item is-center"><a href="/archives/"><div class="headline">文章</div><div class="length-num">38</div></a></div><div class="card-info-data-item is-center"><a href="/tags/"><div class="headline">标签</div><div class="length-num">49</div></a></div><div class="card-info-data-item is-center"><a href="/categories/"><div class="headline">分类</div><div class="length-num">9</div></a></div></div><a class="button--animated" id="card-info-btn" href="javascript:void(0)" onclick="addFav()"><i class="fas fa-star"></i><span>收藏本站</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/rplalala" target="_blank" title="Github"><i class="fab iconfont icon-github"></i></a><a class="social-icon" href="https://mail.qq.com/cgi-bin/qm_share?t=qm_mailme&amp;email=dingzihang00@qq.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a><a class="social-icon" href="https://gitee.com/rplalala" target="_blank" title="Gitee"><i class="fab iconfont icon-gitee-fill-round"></i></a><a class="social-icon" href="https://blog.csdn.net/RP123123123?spm=1000.2115.3001.5343" target="_blank" title="CSDN"><i class="fab iconfont icon-csdn1-copy"></i></a><a class="social-icon" href="https://leetcode-cn.com/u/dingzihang00/" target="_blank" title="LeetCode"><i class="fab iconfont icon-leetcode"></i></a><a class="social-icon" href="https://space.bilibili.com/6964209" target="_blank" title="Bilibili"><i class="fab iconfont icon-bilibili-fill"></i></a><a class="social-icon" href="https://i.y.qq.com/n2/m/share/details/taoge.html?id=3885764921" target="_blank" title="QQ音乐"><i class="fab iconfont icon-QQyinle"></i></a></div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>目录</span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#%E8%A6%81%E6%B1%82"><span class="toc-number">1.</span> <span class="toc-text">要求</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%95%8C%E9%9D%A2%E5%B1%95%E7%A4%BA"><span class="toc-number">2.</span> <span class="toc-text">界面展示</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%99%BB%E5%BD%95%E7%95%8C%E9%9D%A2"><span class="toc-number">2.1.</span> <span class="toc-text">登录界面</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E4%B8%BB%E7%AE%A1%E7%90%86%E5%91%98%E5%8A%9F%E8%83%BD%E9%80%89%E6%8B%A9%E7%95%8C%E9%9D%A2"><span class="toc-number">2.2.</span> <span class="toc-text">主管理员功能选择界面</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%93%8D%E4%BD%9C%E7%AE%A1%E7%90%86%E5%91%98%E7%95%8C%E9%9D%A2"><span class="toc-number">2.3.</span> <span class="toc-text">操作管理员界面</span></a></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E6%93%8D%E4%BD%9C%E5%AD%A6%E7%94%9F%E7%95%8C%E9%9D%A2"><span class="toc-number">2.4.</span> <span class="toc-text">操作学生界面</span></a></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E9%83%A8%E5%88%86%E4%BB%A3%E7%A0%81%E5%B1%95%E7%A4%BA"><span class="toc-number">3.</span> <span class="toc-text">部分代码展示</span></a><ol class="toc-child"><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%94%9F%E6%88%90%E5%A4%A7%E9%87%8F%E5%AD%A6%E7%94%9F%E8%A1%A8"><span class="toc-number">3.1.</span> <span class="toc-text">生成大量学生表</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#InsertStudentData%E7%B1%BB"><span class="toc-number">3.1.1.</span> <span class="toc-text">InsertStudentData类</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#RandInfo%E7%B1%BB"><span class="toc-number">3.1.2.</span> <span class="toc-text">RandInfo类</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E7%AE%A1%E7%90%86%E5%91%98%E4%BF%A1%E6%81%AF%E5%92%8CJDBC%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"><span class="toc-number">3.2.</span> <span class="toc-text">管理员信息和JDBC配置文件</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E7%AE%A1%E7%90%86%E5%91%98%E4%BF%A1%E6%81%AF"><span class="toc-number">3.2.1.</span> <span class="toc-text">管理员信息</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#JDBC%E9%85%8D%E7%BD%AE%E6%96%87%E4%BB%B6"><span class="toc-number">3.2.2.</span> <span class="toc-text">JDBC配置文件</span></a></li></ol></li><li class="toc-item toc-level-2"><a class="toc-link" href="#%E5%9F%BA%E6%9C%AC%E7%BB%93%E6%9E%84"><span class="toc-number">3.3.</span> <span class="toc-text">基本结构</span></a><ol class="toc-child"><li class="toc-item toc-level-3"><a class="toc-link" href="#DBUtils%E7%B1%BB"><span class="toc-number">3.3.1.</span> <span class="toc-text">DBUtils类</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#RegExpHelp"><span class="toc-number">3.3.2.</span> <span class="toc-text">RegExpHelp</span></a></li><li class="toc-item toc-level-3"><a class="toc-link" href="#XMLUtils"><span class="toc-number">3.3.3.</span> <span class="toc-text">XMLUtils</span></a></li></ol></li></ol></li><li class="toc-item toc-level-1"><a class="toc-link" href="#%E7%94%9F%E6%88%90-exe%E5%8F%AF%E6%89%A7%E8%A1%8C%E6%96%87%E4%BB%B6"><span class="toc-number">4.</span> <span class="toc-text">生成.exe可执行文件</span></a></li></ol></div></div><div class="card-widget card-recommend-post"><div class="item-headline"><i class="fas fa-thumbs-up"></i><span>相关推荐</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/b95b9d3f.html" title="AI Trip Assistant 复盘"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover186.jpg" alt="AI Trip Assistant 复盘"></a><div class="content"><a class="title" href="/posts/b95b9d3f.html" title="AI Trip Assistant 复盘">AI Trip Assistant 复盘</a><time datetime="2025-10-27" title="发表于 2025-10-27">2025-10-27</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/2fafc5f1.html" title="MySQL解决删除数据后，自增id的断层问题"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover284.jpg" alt="MySQL解决删除数据后，自增id的断层问题"></a><div class="content"><a class="title" href="/posts/2fafc5f1.html" title="MySQL解决删除数据后，自增id的断层问题">MySQL解决删除数据后，自增id的断层问题</a><time datetime="2022-02-17" title="发表于 2022-02-17">2022-02-17</time></div></div></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>最新文章</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/b6ddf346.html" title="leetcode hot 100 刷题笔记"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover258.jpg" onerror='this.onerror=null,this.src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="leetcode hot 100 刷题笔记"></a><div class="content"><a class="title" href="/posts/b6ddf346.html" title="leetcode hot 100 刷题笔记">leetcode hot 100 刷题笔记</a><time datetime="2025-11-17T10:40:06.000Z" title="发表于 2025-11-17 18:40:06">2025-11-17</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/5b98c3b1.html" title="纯JWT TOKEN 和Redis + JWT TOKEN的区别和应用场景"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover122.jpg" onerror='this.onerror=null,this.src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="纯JWT TOKEN 和Redis + JWT TOKEN的区别和应用场景"></a><div class="content"><a class="title" href="/posts/5b98c3b1.html" title="纯JWT TOKEN 和Redis + JWT TOKEN的区别和应用场景">纯JWT TOKEN 和Redis + JWT TOKEN的区别和应用场景</a><time datetime="2025-11-16T16:24:56.000Z" title="发表于 2025-11-17 00:24:56">2025-11-17</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/14f08eda.html" title="RAG / MCP / Prompt 和一些常用的 Agent 框架"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover155.jpg" onerror='this.onerror=null,this.src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="RAG / MCP / Prompt 和一些常用的 Agent 框架"></a><div class="content"><a class="title" href="/posts/14f08eda.html" title="RAG / MCP / Prompt 和一些常用的 Agent 框架">RAG / MCP / Prompt 和一些常用的 Agent 框架</a><time datetime="2025-11-11T12:46:47.000Z" title="发表于 2025-11-11 20:46:47">2025-11-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/7a10715.html" title="什么是 MCP，什么是 MCP Server"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover16.jpg" onerror='this.onerror=null,this.src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="什么是 MCP，什么是 MCP Server"></a><div class="content"><a class="title" href="/posts/7a10715.html" title="什么是 MCP，什么是 MCP Server">什么是 MCP，什么是 MCP Server</a><time datetime="2025-11-11T08:05:27.000Z" title="发表于 2025-11-11 16:05:27">2025-11-11</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/1383d4dc.html" title="阿里云CDN 配置国内外双源站策略，加快国内外访问"><img src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover39.jpg" onerror='this.onerror=null,this.src="https://alicdn.dingzh.cc/ding-BlogDemo/img/404_img.jpg"' alt="阿里云CDN 配置国内外双源站策略，加快国内外访问"></a><div class="content"><a class="title" href="/posts/1383d4dc.html" title="阿里云CDN 配置国内外双源站策略，加快国内外访问">阿里云CDN 配置国内外双源站策略，加快国内外访问</a><time datetime="2025-11-09T17:28:32.000Z" title="发表于 2025-11-10 01:28:32">2025-11-10</time></div></div></div></div></div></div></main><footer id="footer"><div id="footer-wrap"><div class="copyright"><span>&copy;2021 - 2025</span><svg style="width:1.5em;height:1.5em" aria-hidden="true"><use xlink:href="#icon-diqiu"></use></svg><span>Dingzh</span></div><div class="footer_custom_text"><span id="timeShow"></span></div><p id="ghbdages"><a class="github-badge" target="_blank" href="https://github.com/rplalala/rplalala.github.io" style="margin-inline:5px"><img src="https://img.shields.io/badge/Source-Github-d021d6?style=flat&amp;logo=GitHub" title="本站项目由Github托管"></a><a class="github-badge" target="_blank" href="https://gitee.com/rplalala/rplalala" style="margin-inline:5px"><img src="https://img.shields.io/badge/Mirror-Gitee-0cedbe?style=flat&amp;logo=Gitee" title="本站国内镜像由Gitee托管"></a><a class="github-badge" target="_blank" href="https://vercel.com/" style="margin-inline:5px"><img src="https://img.shields.io/badge/Hosted-Vercel-brightgreen?style=flat&amp;logo=Vercel" title="本站采用双线部署，默认线路托管于Vercel"></a><a class="github-badge" target="_blank" href="https://www.aliyun.com/" style="margin-inline:5px"><img src="https://img.shields.io/badge/CDN-Aliyun-orange?style=flat&amp;logo=AlibabaCloud" title="本站使用阿里云提供CDN加速"></a><a class="github-badge" target="_blank" href="https://beian.miit.gov.cn/" style="margin-inline:5px"><img src="https://img.shields.io/badge/%E9%97%BDICP%E5%A4%87-2022001031%E5%8F%B7-e1d492?style=flat&amp;logo=" title="本站已在工信部备案，备案号闽ICP备-2022001031号"></a><a class="github-badge" target="_blank" href="https://icp.gov.moe/?keyword=20221220" style="margin-inline:5px"><img src="https://img.shields.io/badge/%E8%90%8CICP%E5%A4%87-20221220%E5%8F%B7-fe1384?style-flat&amp;logo=" title="本站已加入萌ICP备，萌号萌ICP备-20221220号"></a><a class="github-badge" target="_blank" href="https://creativecommons.org/licenses/by-nc-sa/4.0/" style="margin-inline:5px"><img src="https://img.shields.io/badge/Copyright-BY--NC--SA%204.0-d42328?style=flat&amp;logo=Claris" title="本站采用知识共享署名-非商业性使用-相同方式共享4.0国际许可协议进行许可"></a><a class="github-badge" target="_blank" href="https://butterfly.js.org/" style="margin-inline:5px"><img src="https://img.shields.io/badge/Theme-Butterfly-6513df?style=flat&amp;logo=bitdefender" title="主题版本为Butterfly_v3.8.4"></a><a class="github-badge" target="_blank" href="https://hexo.io/" style="margin-inline:5px"><img src="https://img.shields.io/badge/Frame-Hexo-blue?style=flat&amp;logo=hexo" title="博客框架为Hexo_v6.0.0"></a></p></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="font-plus" type="button" title="放大字体"><i class="fas fa-plus"></i></button><button id="font-minus" type="button" title="缩小字体"><i class="fas fa-minus"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="设置"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="目录"><i class="fas fa-list-ul"></i></button><button id="readmode" type="button" title="阅读模式"><i class="fas fa-book-open"></i></button><a class="icon-V hidden" onclick="switchNightMode()" title="浅色和深色模式转换"><svg width="25" height="25" viewBox="0 0 1024 1024"><use id="modeicon" xlink:href="#icon-moon"></use></svg></a><button id="change-bg-btn" type="button" title="更换背景" onclick="(function(b){var i=b.querySelector('i');if(i)i.classList.add('fa-spin');b.disabled=true;Promise.resolve(window.changeBackground &amp;&amp; changeBackground()).catch(function(e){try{console.error(e)}catch(e){}}).then(function(){if(i)i.classList.remove('fa-spin');b.disabled=false;});})(this)"><i class="fas fa-image"></i></button><button id="cycle-bg-mode-btn" type="button" title="背景模式" data-title-base="背景模式" data-random-label="随机背景" data-white-label="纯白背景" data-black-label="纯黑背景" onclick="window.cycleBackgroundMode &amp;&amp; cycleBackgroundMode(this)"><i class="fas fa-palette"></i></button><button id="hide-aside-btn" type="button" title="单栏和双栏切换"><i class="fas fa-arrows-alt-h"></i></button><button id="to_comment" type="button" title="直达评论" onclick="FixedCommentBtn()"><i class="fas fa-comments"></i></button><button id="go-up" type="button" title="回到顶部"><i class="fas fa-arrow-up"></i></button></div></div><div id="local-search"><div class="search-dialog"><div class="search-dialog__title" id="local-search-title">本地搜索</div><div id="local-input-panel"><div id="local-search-input"><div class="local-search-box"><input class="local-search-box--input" placeholder="搜索文章" type="text"></div></div></div><hr><div id="local-search-results"></div><span class="search-close-button"><i class="fas fa-times"></i></span></div><div id="search-mask"></div></div><div><script src="https://npm.elemecdn.com/jquery@latest/dist/jquery.min.js"></script><script src="https://alicdn.dingzh.cc/ding-BlogDemo/js/utils.min.js"></script><script src="https://alicdn.dingzh.cc/ding-BlogDemo/js/main.min.js"></script><script defer src="https://npm.elemecdn.com/instant.page/instantpage.js" type="module"></script><script src="https://npm.elemecdn.com/vanilla-lazyload/dist/lazyload.iife.min.js"></script><script defer src="https://npm.elemecdn.com/node-snackbar/dist/snackbar.min.js"></script><script>function panguFn(){"object"==typeof pangu?pangu.autoSpacingPage():getScript("https://alicdn.dingzh.cc/ding-BlogDemo/js/other/pangu.min.js").then(()=>{pangu.autoSpacingPage()})}function panguInit(){panguFn()}document.addEventListener("DOMContentLoaded",panguInit)</script><script defer src="https://alicdn.dingzh.cc/ding-BlogDemo/js/search/local-search.min.js"></script><script async>var preloader={endLoading:()=>{document.body.style.overflow="auto",document.getElementById("loading-box").classList.add("loaded")},initLoading:()=>{document.body.style.overflow="",document.getElementById("loading-box").classList.remove("loaded")}};window.addEventListener("load",()=>{preloader.endLoading()}),setTimeout((function(){preloader.endLoading()}),2500)</script><div class="js-pjax"><script>(()=>{const t=document.getElementById("twikoo-count"),o=()=>{twikoo.init(Object.assign({el:"#twikoo-wrap",envId:"https://twikoo.dingzh.cc/",region:""},null))},n=()=>{twikoo.getCommentsCount({envId:"https://twikoo.dingzh.cc/",region:"",urls:[window.location.pathname],includeReply:!1}).then((function(o){t.innerText=o[0].count})).catch((function(t){console.error(t)}))},e=(e=!1)=>{"object"==typeof twikoo?(o(),e&&t&&setTimeout(n,0)):getScript("https://alicdn.dingzh.cc/ding-BlogDemo/js/other/twikoo.all.min.js").then(()=>{o(),e&&t&&setTimeout(n,0)})};btf.loadComment(document.getElementById("twikoo-wrap"),e)})()</script></div><script>window.addEventListener("load",()=>{const e=e=>{let t="";if(e.length)for(let n=0;n<e.length;n++){t+="<div class='aside-list-item'>";{const a="data-lazy-src";t+=`<a href='${e[n].url}' class='thumbnail'><img ${a}='${e[n].avatar}' alt='${e[n].nick}'></a>`}t+=`<div class='content'>\n        <a class='comment' href='${e[n].url}'>${e[n].content}</a>\n        <div class='name'><span>${e[n].nick} / </span><time datetime="${e[n].date}">${btf.diffDate(e[n].date,!0)}</time></div>\n        </div></div>`}else t+="没有评论";let n=document.querySelector("#card-newest-comments .aside-list");n.innerHTML=t,window.lazyLoadInstance&&window.lazyLoadInstance.update(),window.pjax&&window.pjax.refresh(n)},t=()=>{if(document.querySelector("#card-newest-comments .aside-list")){const t=saveToLocal.get("twikoo-newest-comments");t?e(JSON.parse(t)):(()=>{const t=()=>{twikoo.getRecentComments({envId:"https://twikoo.dingzh.cc/",region:"",pageSize:6,includeReply:!0}).then((function(t){const n=t.map(e=>{return{content:(t=e.comment,""===t||(t=(t=(t=(t=t.replace(/<img.*?src="(.*?)"?[^\>]+>/gi,"[图片]")).replace(/<a[^>]+?href=["']?([^"']+)["']?[^>]*>([^<]+)<\/a>/gi,"[链接]")).replace(/<pre><code>.*?<\/pre>/gi,"[代码]")).replace(/<[^>]+>/g,"")).length>150&&(t=t.substring(0,150)+"..."),t),avatar:e.avatar,nick:e.nick,url:e.url+"#"+e.id,date:new Date(e.created).toISOString()};var t});saveToLocal.set("twikoo-newest-comments",JSON.stringify(n),10/1440),e(n)})).catch((function(e){document.querySelector("#card-newest-comments .aside-list").innerHTML="无法获取评论，请确认相关配置是否正确"}))};"object"==typeof twikoo?t():getScript("https://alicdn.dingzh.cc/ding-BlogDemo/js/other/twikoo.all.min.js").then(t)})()}};t(),document.addEventListener("pjax:complete",t)})</script><script async src="https://alicdn.dingzh.cc/ding-BlogDemo/js/custom/myJS.min.js"></script><script async src="https://at.alicdn.com/t/font_3113985_v9z1ah1pbeo.js"></script><script async src="https://at.alicdn.com/t/font_2032782_ev6ytrh30f.js"></script><script defer src="https://alicdn.dingzh.cc/ding-BlogDemo/js/custom/baidu_sub.min.js"></script><script data-pjax defer src="https://alicdn.dingzh.cc/ding-BlogDemo/js/custom/fixed_card_widget.min.js"></script><script data-pjax defer src="https://alicdn.dingzh.cc/ding-BlogDemo/js/custom/fixedComment_twikoo.min.js"></script><script src="https://alicdn.dingzh.cc/ding-BlogDemo/js/custom/sun_moon.min.js" async></script><script src="https://npm.elemecdn.com/butterfly-extsrc@1/dist/activate-power-mode.min.js"></script><script>POWERMODE.colorful=!0,POWERMODE.shake=!1,POWERMODE.mobile=!1,document.body.addEventListener("input",POWERMODE)</script><script id="click-heart" src="https://npm.elemecdn.com/butterfly-extsrc@1/dist/click-heart.min.js" async mobile="false"></script><script src="https://npm.elemecdn.com/pjax/pjax.min.js"></script><script>let pjaxSelectors=["title","#config-diff","#body-wrap","#rightside-config-hide","#rightside-config-show","#fixedcard-dashboard",".js-pjax"];var pjax=new Pjax({elements:'a:not([target="_blank"])',selectors:pjaxSelectors,cacheBust:!1,analytics:!1,scrollRestoration:!1});document.addEventListener("pjax:send",(function(){if(window.removeEventListener("scroll",window.tocScrollFn),window.removeEventListener("scroll",scrollCollect),"object"==typeof preloader&&preloader.initLoading(),window.aplayers)for(let e=0;e<window.aplayers.length;e++)window.aplayers[e].options.fixed||window.aplayers[e].destroy();"object"==typeof typed&&typed.destroy();const e=document.body.classList;e.contains("read-mode")&&e.remove("read-mode")})),document.addEventListener("pjax:complete",(function(){window.refreshFn(),document.querySelectorAll("script[data-pjax]").forEach(e=>{const t=document.createElement("script"),o=e.text||e.textContent||e.innerHTML||"";Array.from(e.attributes).forEach(e=>t.setAttribute(e.name,e.value)),t.appendChild(document.createTextNode(o)),e.parentNode.replaceChild(t,e)}),GLOBAL_CONFIG.islazyload&&window.lazyLoadInstance.update(),"function"==typeof chatBtnFn&&chatBtnFn(),"function"==typeof panguInit&&panguInit(),"function"==typeof gtag&&gtag("config","",{page_path:window.location.pathname}),"object"==typeof _hmt&&_hmt.push(["_trackPageview",window.location.pathname]),"object"==typeof Prism&&Prism.highlightAll(),"object"==typeof preloader&&preloader.endLoading()})),document.addEventListener("pjax:error",e=>{404===e.request.status&&pjax.loadUrl("/404.html")})</script><script async data-pjax src="https://busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script><div id="fixedcard-dashboard"><button class="fixedcard-activebtn" type="button" title="用户信息" onclick="FixedCardWidget(&quot;class&quot;,&quot;card-info&quot;,&quot;0&quot;)"><i class="fas fa-address-book"></i></button><button class="fixedcard-activebtn" type="button" title="电子钟" onclick="FixedCardWidget(&quot;class&quot;,&quot;card-clock&quot;,&quot;0&quot;)"><i class="fas fa-cloud-sun"></i></button><button class="fixedcard-activebtn" type="button" title="最新文章" onclick="FixedCardWidget(&quot;class&quot;,&quot;card-recent-post&quot;,&quot;0&quot;)"><i class="fas fa-history"></i></button><button class="fixedcard-activebtn" type="button" title="相关推荐" onclick="FixedCardWidget(&quot;class&quot;,&quot;card-recommend-post&quot;,&quot;0&quot;)"><i class="fas fa-thumbs-up"></i></button><div class="fixedcard-user-avatar fixedcard-activebtn" onclick="RemoveFixedCardWidget()"><img class="fixedcard-user-avatar-img" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/head1.jpg" title="Dingzh"></div></div><div class="app-refresh" id="app-refresh" style="position:fixed;top:-2.2rem;left:0;right:0;z-index:99999;padding:0 1rem;font-size:15px;height:2.2rem;transition:all .3s ease"><div class="app-refresh-wrap" style="display:flex;color:#fff;height:100%;align-items:center;justify-content:center"><label>🌈本站有新文章啦💌</label><a href="javascript:void(0)" onclick='top.location.href="/"'><span style="color:#fff;text-decoration:underline;cursor:pointer">🔎查看🤗</span></a></div></div><script>function showNotification(){if(GLOBAL_CONFIG.Snackbar){var t="light"===document.documentElement.getAttribute("data-theme")?GLOBAL_CONFIG.Snackbar.bgLight:GLOBAL_CONFIG.Snackbar.bgDark,e=GLOBAL_CONFIG.Snackbar.position;Snackbar.show({text:"🌈本站有新文章啦💌",backgroundColor:t,duration:5e5,pos:e,actionText:"🔎查看🤗",actionTextColor:"#fff",onActionClick:function(t){top.location.href="/"}})}else{var o=`top: 0; background: ${"light"===document.documentElement.getAttribute("data-theme")?"#49b1f5":"#1f1f1f"};`;document.getElementById("app-refresh").style.cssText=o}}"serviceWorker"in navigator&&(navigator.serviceWorker.controller&&navigator.serviceWorker.addEventListener("controllerchange",(function(){showNotification()})),window.addEventListener("load",(function(){navigator.serviceWorker.register("/sw.js")})))</script></div><script data-pjax>function card_artitalk_injector_config(){var a=document.getElementsByClassName("sticky_layout")[0];console.log("已挂载card_artitalk"),a.insertAdjacentHTML("afterbegin",'<div class="card-widget card-shuo"><div class="card-content" style="height:auto;min-height:280px;"><div class="item-headline"><i class="fas fa-comments"></i><span><a href="/artitalk/" title="artitalk page link">随言</a></span><a id="cardVisual" style="cursor:pointer;float:right" onclick="cardVisual()">编辑</a></div><div id="artitalk_main" style="width:100%;height:100%;padding:1px"></div></div></div>'),(()=>{const a=()=>{new Artitalk(Object.assign({appId:"5EG25co78od7O4GsnIcIySD9-MdYXbMMI",appKey:"e8zuU9tM3oRrN9kp9PWQwmYW"},{serverURL:"https://talkapi.dingzh.cc",lang:"zh",pageSize:1,color1:"#ff6262",color2:"#00a9c4",atEmoji:null}))};"function"==typeof Artitalk?a():getScript("https://npm.elemecdn.com/artitalk").then(a)})()}for(var elist="/artitalk/,/posts/".split(","),cpage=location.pathname,epage="/",flag=0,i=0;i<elist.length;i++)cpage.includes(elist[i])&&flag++;("all"===epage&&0==flag||epage===cpage)&&card_artitalk_injector_config()</script><script async src="https://alicdn.dingzh.cc/ding-BlogDemo/js/other/card_visual.min.js"></script><script data-pjax>function butterfly_clock_anzhiyu_injector_config(){var a=document.getElementsByClassName("sticky_layout")[0];console.log("已挂载butterfly_clock_anzhiyu"),a&&a.insertAdjacentHTML("afterbegin",'<div class="card-widget card-clock"><div class="card-glass"><div class="card-background"><div class="card-content"><div id="hexo_electric_clock"><img class="entered loading" id="card-clock-loading" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/loading.gif" style="height: 120px; width: 100%;" data-ll-status="loading"/></div></div></div></div></div>')}for(var elist="/archives/,/tags/,/categories/,/anime/,/gallery/,/artitalk/,/messageboard/,/link/,/about/".split(","),cpage=location.pathname,epage="all",qweather_key="dec7b69d45ab4dc4b9c3a6e8a13eb498",gaud_map_key="92c61ec107a5fc3b3abccc79ee948148",baidu_ak_key="undefined",flag=0,clock_rectangle="119.306239,26.075302",clock_default_rectangle_enable="false",i=0;i<elist.length;i++)cpage.includes(elist[i])&&flag++;("all"===epage&&0==flag||epage===cpage)&&butterfly_clock_anzhiyu_injector_config()</script><script src="https://pv.sohu.com/cityjson?ie=utf-8"></script><script data-pjax src="https://alicdn.dingzh.cc/ding-BlogDemo/clock/clock.min.js"></script><script data-pjax>function butterfly_swiper_injector_config(){var i=document.getElementsByClassName("recent-posts")[0];console.log("已挂载butterfly_swiper"),i.insertAdjacentHTML("afterbegin",'<div class="recent-post-item" style="height: auto;width: 100%"><div class="blog-slider swiper-container-fade swiper-container-horizontal" id="swiper_container"><div class="blog-slider__wrp swiper-wrapper" style="transition-duration: 0ms;"><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/d4e383e3.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover217.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2025-11-09</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/d4e383e3.html&quot;);" href="javascript:void(0);" alt="">对 AI Agent 的一些粗浅理解</a><div class="blog-slider__text">总结我目前 AI Agent 的一些粗浅理解</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/d4e383e3.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/b95b9d3f.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover186.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2025-10-28</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/b95b9d3f.html&quot;);" href="javascript:void(0);" alt="">AI Trip Assistant 复盘</a><div class="blog-slider__text">USYD 5620 小组项目AI Trip Assistant 复盘</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/b95b9d3f.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/7a10715.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover16.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2025-11-11</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/7a10715.html&quot;);" href="javascript:void(0);" alt="">什么是 MCP，什么是 MCP Server</a><div class="blog-slider__text">理解 MCP 协议及 MCP Server 的作用</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/7a10715.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/14f08eda.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover155.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2025-11-11</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/14f08eda.html&quot;);" href="javascript:void(0);" alt="">RAG / MCP / Prompt 和一些常用的 Agent 框架</a><div class="blog-slider__text">理解 RAG、MCP 和 Prompt 在 Agent 中的角色与区别，以及常用的 Agent 框架</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/14f08eda.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/8da89045.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover239.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-01-06</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/8da89045.html&quot;);" href="javascript:void(0);" alt="">seo优化超详细步骤 — hexo_butterfly</a><div class="blog-slider__text">搜索引擎收录博客详细步骤，并讲解如何对博客进行SEO优化</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/8da89045.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/b3f89ff3.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover117.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-01-05</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/b3f89ff3.html&quot;);" href="javascript:void(0);" alt="">JS、CSS异步加载优化方案</a><div class="blog-slider__text">拜读Akilar店长的文章后，自己对JS、CSS异步加载的总结与体会</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/b3f89ff3.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div><div class="blog-slider__item swiper-slide" style="width: 750px; opacity: 1; transform: translate3d(0px, 0px, 0px); transition-duration: 0ms;"><a class="blog-slider__img" onclick="pjax.loadUrl(&quot;posts/b4caf892.html&quot;);" href="javascript:void(0);" alt=""><img width="48" height="48" src="https://alicdn.dingzh.cc/ding-BlogDemo/img/cover/cover131.jpg" alt="" onerror="this.src=https://unpkg.zhimg.com/akilar-candyassets/image/loading.gif; this.onerror = null;"/></a><div class="blog-slider__content"><span class="blog-slider__code">2022-01-07</span><a class="blog-slider__title" onclick="pjax.loadUrl(&quot;posts/b4caf892.html&quot;);" href="javascript:void(0);" alt="">部署博客中各种踩坑点记录</a><div class="blog-slider__text">部署博客也有半个月了，中间遇到了许多坑点，这里总结一下常规操作吧（其实也没多少，懒得写- -）。持续更新~</div><a class="blog-slider__button" onclick="pjax.loadUrl(&quot;posts/b4caf892.html&quot;);" href="javascript:void(0);" alt="">详情       </a></div></div></div><div class="blog-slider__pagination swiper-pagination-clickable swiper-pagination-bullets"></div></div></div>')}for(var elist="undefined".split(","),cpage=location.pathname,epage="/",flag=0,i=0;i<elist.length;i++)cpage.includes(elist[i])&&flag++;("all"===epage&&0==flag||epage===cpage)&&butterfly_swiper_injector_config()</script><script defer src="https://npm.elemecdn.com/hexo-butterfly-swiper/lib/swiper.min.js"></script><script defer data-pjax src="https://alicdn.dingzh.cc/ding-BlogDemo/js/other/swiper_init.min.js"></script><div class="js-pjax"><script async>for(var arr=document.getElementsByClassName("recent-post-item"),i=0;i<arr.length;i++)arr[i].classList.add("wow"),arr[i].classList.add("animate__fadeIn"),arr[i].setAttribute("data-wow-duration",""),arr[i].setAttribute("data-wow-delay",""),arr[i].setAttribute("data-wow-offset",""),arr[i].setAttribute("data-wow-iteration","")</script><script async>for(var arr=document.getElementsByClassName("card-widget"),i=0;i<arr.length;i++)arr[i].classList.add("wow"),arr[i].classList.add("animate__fadeIn"),arr[i].setAttribute("data-wow-duration",""),arr[i].setAttribute("data-wow-delay",""),arr[i].setAttribute("data-wow-offset",""),arr[i].setAttribute("data-wow-iteration","")</script><script async>for(var arr=document.getElementsByClassName("article-sort-item"),i=0;i<arr.length;i++)arr[i].classList.add("wow"),arr[i].classList.add("animate__fadeIn"),arr[i].setAttribute("data-wow-duration","1.2s"),arr[i].setAttribute("data-wow-delay",""),arr[i].setAttribute("data-wow-offset",""),arr[i].setAttribute("data-wow-iteration","")</script><script async>for(var arr=document.getElementsByClassName("flink-list-card"),i=0;i<arr.length;i++)arr[i].classList.add("wow"),arr[i].classList.add("animate__backInDown"),arr[i].setAttribute("data-wow-duration","1.2s"),arr[i].setAttribute("data-wow-delay",""),arr[i].setAttribute("data-wow-offset",""),arr[i].setAttribute("data-wow-iteration","")</script></div><script defer src="https://npm.elemecdn.com/hexo-butterfly-wowjs/lib/wow.min.js"></script><script defer src="https://npm.elemecdn.com/hexo-butterfly-wowjs/lib/wow_init.js"></script></body></html>